package node;

import lexer.LexType;
import parser.Parser;

import java.io.IOException;

public class MainFuncDefNode extends ASTNode {
    public final String name = "<MainFuncDef>";
    // MainFuncDef → 'int' 'main' '(' ')' Block
    private final BlockNode blockNode;

    public MainFuncDefNode(BlockNode blockNode) {
        this.blockNode = blockNode;
    }

    @Override
    public void show() throws IOException {
        Parser.parserWriter.write(LexType.INTTK + " " + "int" + "\n");
        Parser.parserWriter.write(LexType.MAINTK + " " + "main" + "\n");
        Parser.parserWriter.write(LexType.LPARENT + " " + "(" + "\n");
        Parser.parserWriter.write(LexType.RPARENT + " " + ")" + "\n");

        blockNode.show();

        Parser.parserWriter.write(name + "\n");
    }

}
